import movePanorama
import monitorRename
import time
import vtourMaker
import json

# 使用脚本时在这里定义父文件夹路径
print('\n===============初始化配置=================\n')
config_file_path = "config.json"
"""读取 JSON 配置文件并返回内容"""
with open(config_file_path, 'r',encoding='utf-8') as file:
    config = json.load(file)
print(json.dumps(config, indent=4, ensure_ascii=False))  # 使用 json.dumps 格式化输出
parent_folder_path = input("输入父文件夹：")


print('\n===============启动全景图移动工具=================\n')
# parent_folder_path = r'E:\事务\上海\拍摄文件\原始数据\W7'
panorama_folder_set = movePanorama.process(parent_folder_path)

print('\n===============启动文件重命名工具=================\n')

# 错误文件夹集合
err_set = []
# 开始监控文件夹
for folder in panorama_folder_set:
    err_tag = monitorRename.monitor_folder(folder)
    if err_tag == 1:
        err_set.append(folder)
    time.sleep(0.1)

print('\n===============启动文件生产工具=================\n')

vtourMaker.make_vtour(panorama_folder_set,config_file_path)

print("\nError folder(s): {0}".format(err_set))
print("\nover!")
